package com.xinke.module.system.mapper.sms;

import java.util.*;

import com.xinke.component.common.pojo.PageResult;
import com.xinke.component.mybatis.mybatis.core.query.LambdaQueryWrapperExt;
import com.xinke.component.mybatis.mybatis.core.mapper.BaseMapperExt;
import com.xinke.module.system.model.entity.sms.SmsChannelDO;
import org.apache.ibatis.annotations.Mapper;
import com.xinke.module.system.model.vo.sms.*;

/**
 * 短信渠道 Mapper
 *
 * @author yzx
 */
@Mapper
public interface SmsChannelMapper extends BaseMapperExt<SmsChannelDO> {

    default PageResult<SmsChannelDO> selectPage(SmsChannelPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperExt<SmsChannelDO>()
                .eqIfPresent(SmsChannelDO::getSmsSignature, reqVO.getSmsSignature())
                .eqIfPresent(SmsChannelDO::getChannelCode, reqVO.getChannelCode())
                .eqIfPresent(SmsChannelDO::getChannelStatus, reqVO.getChannelStatus())
                .eqIfPresent(SmsChannelDO::getRemark, reqVO.getRemark())
                .eqIfPresent(SmsChannelDO::getApiKey, reqVO.getApiKey())
                .eqIfPresent(SmsChannelDO::getApiSecret, reqVO.getApiSecret())
                .eqIfPresent(SmsChannelDO::getCallbackUrl, reqVO.getCallbackUrl())
                .orderByDesc(SmsChannelDO::getChannelId));
    }

}